"""
例1：有四个数字：1、2、3、4，能组成多少个互不相同且无重复数字的三位数？各是多少？
"""

import itertools


def t1():
    new_list = []
    for i in range(1, 5):
        for j in range(1, 5):
            for k in range(1, 5):
                if (i != j) and (j != k) and (i != k):
                    a = i*100 + j*10 + k
                    new_list.append(a)
    print(new_list)


def t2():
    result = []
    numbers = [1, 2, 3, 4]
    middle = itertools.permutations(numbers, 3)
    for i, j, k in middle:
        a = i*100 + j*10 + k
        result.append(a)
    print(result)


t1()
t2()
